package com.ibeeking.found.common.enums;

/**
 * @Author ibeeking
 * @Date: 2021-01-05 19:15
 * @Description: 或且enum
 */
public enum AndOrEnum {
    OR("或", 1),
    AND("且",2),;

    private String desc;
    private Integer code;

    AndOrEnum(String desc, int code) {
        this.code = code;
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public Integer getCode() {
        return code;
    }

    public static String getDescByCode(Integer code) {
        for (AndOrEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getDesc();
            }
        }
        return null;
    }

    public static AndOrEnum getEnumByCode(Integer code) {
        for (AndOrEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }
}
